package com.example.tests;

import org.testng.annotations.Test;

public class LoginTests extends TestBase{
	
  @Test
  public void testLoginAsExistingUser() throws Exception {
	openMainPage();
    openLoginForm();
    LoginData loginCredentials = new LoginData();
    loginCredentials.email = "tatyana.sivnitskaya@udozi.com";
    loginCredentials.password = "1111";
	fillLoginForm(loginCredentials);
    submitLoginInfo();
    verificationSuccessLogin();  
    logOutFromSite();
  }
  
  @Test
  public void testLoginNonExistingUser() throws Exception {
	openMainPage();
    openLoginForm();
    LoginData loginCredentials = new LoginData();
    loginCredentials.email = "tanya@udozi.com";
    loginCredentials.password = "1111";
	fillLoginForm(loginCredentials);
    submitLoginInfo();
    verificationNonSuccessLogin(); 
   
  }
  
  @Test
  public void testLoginSuspendedUser() throws Exception {
	// Login as Udozi Admin
	openMainPage();
    openLoginForm();
    LoginData loginCredentials = new LoginData();
    loginCredentials.email = "admin2@udozi.com";
	loginCredentials.password = "2710FA8D";
	fillLoginForm(loginCredentials);
	submitLoginInfo();
	verificationSuccessLogin();  
	makeUserSuspended("tatyana.sivnitskaya@udozi.com");
	logOutFromSite();
	//Try to Login as Suspended User
	openLoginForm();
    loginCredentials.email = "tatyana.sivnitskaya@udozi.com";
    loginCredentials.password = "1111";
	fillLoginForm(loginCredentials);
    submitLoginInfo();
	verificationSuspendedUserLogin();
  }
  
}

